package com.tjw.ec.upms.api.feign.fallback;

import com.tjw.ec.common.core.util.PageUtils;
import com.tjw.ec.common.core.util.Response;
import com.tjw.ec.upms.api.entity.ActionEntity;
import com.tjw.ec.upms.api.feign.RemoteActionService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 远程调用异常处理 : 系统中所有操作的动作表;
 *
 * @author T-junwen
 * @email t-junwen@foxmail.com
 * @date 2019-07-27 17:15:06
 */
@Slf4j
@Component
public class RemoteActionServiceFallbackImpl implements RemoteActionService {

    @Setter
    private Throwable cause;


    /**
     * @param params
     * @Title: 远程调用动作分页列表
     * @Param: [params]
     * @return: com.baomidou.mybatisplus.extension.api.R<com.tjw.ec.common.core.util.PageUtils < com.tjw.ec.upms.api.entity.ActionEntity>>
     * @Author: 田俊文
     * @Date: 2019/8/2 9:06
     * @Throws:
     */
    @Override
    public Response<PageUtils<ActionEntity>> page(Map<String, Object> params) {
        log.error("服务不可用!");
        return Response.faile();
    }

    /**
     * 信息
     *
     * @param actionId
     */
    @Override
    public Response<ActionEntity> info(String actionId) {
        log.info("===================1===================");
        log.error(cause.getMessage());
        log.info("===================2===================");
        log.error(cause.getCause().getMessage());
        log.info("===================3===================");
        return Response.faile();
    }
}

